using System;
using System.ComponentModel;
using System.Data;
using System.Collections.Generic;

namespace PlacementManager
{
    public partial class LinkUnitCampusComponent
    {
        /// <summary>
        /// Selects one record from the database table using the primary key.
        /// </summary>
        /// <returns>An object of a type representing a row in the database table.</returns>
        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public LinkUnitCampus SelectOneWUnitIdCampusID(int UnitId, int CampusId)
        {
            PlacementManager.DAL.LinkUnitCampus_DAL o = new PlacementManager.DAL.LinkUnitCampus_DAL();
            o.UnitId = UnitId;
            o.CampusId = CampusId;
            DataTable dt = o.SelectOneWUnitIdCampusId().Tables[0];

            if (dt.Rows.Count > 0)
            {
                DataRow row = dt.Rows[0];
                PlacementManager.LinkUnitCampus LinkUnitCampusToReturn = new PlacementManager.LinkUnitCampus((int)row["UnitCampusId"], (int)row["UnitId"], (int)row["CampusId"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]);
                return LinkUnitCampusToReturn;
            }
            else
            {
                PlacementManager.LinkUnitCampus LinkUnitCampusToReturnEmpty = new PlacementManager.LinkUnitCampus();
                return LinkUnitCampusToReturnEmpty;
            }
        }
	}

}
